package cn.clwxy.gdz.service;

import java.util.List;

import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import cn.clwxy.gdz.bo.StudentInfoBean;
import cn.clwxy.gdz.util.BaseDao;

public class StudentInfoBeanServiceImpl extends BaseDao implements
		StudentInfoBeanService {

	@Override
	public StudentInfoBean getStudentInfo(Integer studentId) {
		String sql = "SELECT "
				+ " s.studentId,studentName,studentSex,studentPhone,studentDesc,studentDate,other,"
				+ " group_concat(sj.subjectName) subjectName,i.src,g.gradeName,ac.addressName,sas.addressDesc,s.workType,tt.type "
				+ " FROM student s "
				+ " INNER JOIN grade g ON studentGradeId=g.id "
				+ " INNER JOIN imgid i ON i.id=studentImgId "
				+ " INNER JOIN studentsubjectrrelative ss ON s.studentId=ss.studentId "
				+ " INNER JOIN subject sj ON sj.subjectId=ss.subjectId "
				+ " INNER JOIN studentadderss sas ON sas.studentId=s.studentId "
				+ " INNER JOIN addresscounty ac ON ac.addressId= sas.addressCountyId "
				+ " INNER JOIN teachertype tt ON s.requireteacherId=tt.id "
				+ " where s.studentId=? GROUP BY s.studentId  ";
		return super.querySingle(sql, new BeanHandler<StudentInfoBean>(
				StudentInfoBean.class), studentId);
	}

}
